IModel.RelateAt method

Namespace: NextDesign.Core

Description

Associates the given model with the specified position in this instance, and returns the added related instance.

argument

Name Type Description
fieldName string Field name
Null or empty string cannot be specified.
opposite IModel The model to associate
null cannot be specified.
direction string Additional direction in association field
-"first": first
-"last": last
-"before": before
-"after": after
index int Additional reference position
Specify the index with 0 as the start position.
When the direction is specified as "first", it will be associated at the beginning regardless of the index value.
When the direction is specified as "last", it is associated at the end regardless of the index value.
If the direction is "before", the instance is associated with the specified position, and if "after", the instance is associated with the position next to the specified position.

Return value

Exception

Name Exception Class Description
Invalid argument ExtensionArgumentException When null is specified for opposite
When null is specified for fieldName or when an empty string is specified
When a character string other than the default character string is specified for direction
Field not found ExtensionFieldNotFoundException If the specified field is not found in the metaclass of the destination instance
Incorrect index range ExtensionOutOfRangeException If a negative number is specified for index
or if a value greater than the number of elements in the corresponding field is specified for index
Illegal operation ExtensionInvalidOperationException If the model itself is a deleted model or temporary proxy
If an inoperable field is specified in the field name
-Product line feature assignment field
-System.Core tag Granted field
-owned field
Constraint violation ExtensionIllegalFieldAccessException When the model to be associated is not compatible with the data type of the specified field
When the multiplicity constraint of the field is violated by association
The path constraint of the field is violated by association
If an invalid model is specified ExtensionInvalidModelException If the deleted model or temporary proxy is specified in the associated model